<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
	'name'     => 'DSitC / Dev',
	
	'defaultController' => 'home',
	
	'sourceLanguage' => 'en',
	'language'       => 'de',

	// preloading 'log' component
	'preload' => array(
		'log',
	),

	// autoloading model and component classes
	'import'   => array(
		'application.models.*',
		'application.models.forms.*',
		'application.components.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
		'application.modules.admin.models.*',
		'application.modules.admin.components.*',
	),

	'modules'  => array(
		'admin'   => array(),
		'user'    => array(),
		'project' => array(),
		'gii'     => array(
			'class'     => 'system.gii.GiiModule',
			'password'  => 'mw123',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters' => array('127.0.0.1', '::1'),
		),
	),

	// application components
	'components' => array(
		
		'user' => array(
			'allowAutoLogin' => true,
			'loginUrl'       => array('/user/login'),
		),
		
		'urlManager' => array(
			'urlFormat'      => 'path',
			'showScriptName' => false,
			'rules'          => array(
				array('<controller>/view',     'pattern' => '<controller:\w+>/<id:\d+>',              'caseSensitive' => false),
				array('<controller>/<action>', 'pattern' => '<controller:\w+>/<action:\w+>/<id:\d+>', 'caseSensitive' => false),
				array('<controller>/<action>', 'pattern' => '<controller:\w+>/<action:\w+>',          'caseSensitive' => false),
			),
		),
		
		'db' => array(
			'connectionString' => 'mysql:host=localhost;dbname=dev_dsitc_de',
			'emulatePrepare'   => true,
			'username'         => 'root',
			'password'         => 'root',
			'charset'          => 'utf8',
			'tablePrefix'      => '',
		),
		
		'errorHandler' => array(
			// use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
		
		'menu' => array(
			'class' => 'MenuManager',
		),
		
   		'messages' => array(
      		'class'                  => 'CDbMessageSource',
			'language'               => 'en',
			'sourceMessageTable'     => 'MessageSource',
			'translatedMessageTable' => 'MessageTranslated',
			'onMissingTranslation'   => function($event) {
				Yii::app()->i18nHelper->addMessageSource($event->category, $event->message);
				Yii::trace('Missing translation for language "'.$event->language.'" in category "'.$event->category.'": "'.$event->message.'"!', 'system.messages');
				// $event->handled = true;
			},
   		),
		
		'i18nHelper' => array(
			'class' => 'I18NHelper'
		),
		
		'log' => array(
			'class'  => 'CLogRouter',
			'routes' => array(
				array(
					'class'  => 'CFileLogRoute',
					'levels' => 'error, warning',
				),
				array(
					'class'  => 'CWebLogRoute',
				),
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params' => array(
		'owner.title'     => 'Martin Gelder',
		'owner.email'     => 'darkspotinthecorner@gmail.com',
		'email.noreply'   => 'noreply@dsitc.de',
		'email.community' => 'community@dsitc.de',
	),
);